package NPE_STAT;

import java.io.File;
import java.io.IOException;

public class Example {
    File f= new File("./");
    public void printAbsoluteParentPath() {


        final File parent = f.getParentFile();
        if (parent != null) {
            String absolutePath = parent.getAbsolutePath();
            System.out.println("absolute path " + absolutePath);
        }
    }

    public void printCanonicalParentPath() throws IOException {
        final File parent = f.getParentFile();
        if (parent != null) {
            String canonicalPath = parent.getCanonicalPath();
            System.out.println("canonical path: " + canonicalPath);
        }
    }

    public void printParentPath() throws IOException {
        String path = f.getParentFile().getPath();
        System.out.println("path " + path);
    }
}
